package com.winsomely.leecode;

import java.util.HashMap;
import java.util.Map;

/**
 * 反转字符串
 * 
 * @author liujiawei
 *
 */
public class ReverseString {

	public void reverseString(char[] s) {
		char t;
		for (int i = 0, j = s.length - 1; i < j; i++, j--) {
			if (s[i] == s[j]) {
				continue;
			}
			t = s[i];
			s[i] = s[j];
			s[j] = t;
		}
	}

	public static void main(String[] args) {
		char[] s = { 'A', 'B', 'c', 'D', 'B', 'A' };
		ReverseString t = new ReverseString();
		t.reverseString(s);
		for (int k = 0; k < s.length; k++) {
			System.out.print(s[k] + ", ");
		}
	}

}
